<template>
	<view>
		<z-paging ref="paging" autowire-list-name="dataList" autowire-query-name="getList">
			<view class="content">
				<u-navbar back-text="" slot="center" :autoBack="true" safeAreaInsetTop placeholder>
					<view slot="center" class="leftText">搜索好活信息</view>
				</u-navbar>
				<view class="center">
					<view class="search">
						<view class="searchTop">
							<view class="addr" @click="addressisShow = true; hideKeyboard()">
								<text>{{address?address:'地点'}}</text>
								<u-icon name="arrow-down" color="#000" size="12"></u-icon>
							</view>
							<view class="search">
								<u-icon name="search" color="#000" size="24"></u-icon>
								<u--input v-model="seachform.keyWords" border="none" placeholder="搜索你要找的好活"
									color="#A1A1A1" placeholderStyle="color:rgba(255,255,255,.5)"></u--input>
							</view>
							<view class="right" @click="sendSearch">搜索</view>
						</view>
						<block v-if="dataList && dataList.length>0 || dataList.length>0">
							<!-- <z-paging ref="paging" v-model="dataList" @query="getList"></z-paging> -->
							<scroll-view scroll-y="true" class="scroll-Y" :show-scrollbar="false">
								<JobItem v-for="(item,index) in dataList" :key="index" :data="item"
									@jobItemClick="jobItemClick"></JobItem>
							</scroll-view>
							<!-- </z-paging> -->
						</block>
						<block v-if="dataList && dataList.length == 0 && dataList.length == 0">
							<view class="empty-img">
								<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/icon50.png"></image>
								<label>暂无内容</label>
							</view>
						</block>
					</view>
				</view>
				<w-picker :visible.sync="addressisShow" mode="region" :value="defaultRegion" default-type="value"
					:hide-area="false" @confirm="addressConfirm($event,'region')" @cancel="addressCancel" @touchmove.stop.prevent
					ref="region"></w-picker>
			</view>
		</z-paging>
	</view>
</template>
<script>
	import store from '@/common/store.js'
	import pop from "@/components/ming-pop/ming-city.vue"
	import Index from './index-model.js'
	let index = new Index();
	export default {
		data() {
			return {
				defaultRegion: ["610000", "610100", "610112"],
				cityId: null,
				areaId: null,
				provinceId: null,
				address: '',
				addressisShow: false, // 是否显示地点弹框
				direction: 'below',
				dataList: [],
				seachform: {
					keyWords: '',
					cityId:null,
					areaId:null,
					provinceId:null
				},
				
			};
		},
		components: {
			pop
		},
		onLoad() {
			this.getCityList()
		},
		methods: {
			jobItemClick(data) {
				console.log('你点到我了～～～小心点', data)
				uni.navigateTo({
					url: "/pagesB/jobinfo/jobLeavetwoInfo?cardID=" + data.data.id
				})
				uni.setStorage({
					key: 'cardID',
					data: data.data.id,
					success: () => {
						console.log('存入成功')
					}
				})
			},
			// 隐藏键盘
			hideKeyboard() {
				uni.hideKeyboard()
			},
			addressCancel() {
				this.addressisShow = false
				this.seachform.cityId = null
				this.seachform.areaId = null
				this.seachform.provinceId = null
				this.address = ''
				this.seachform.keyWords=''
				this.$refs.paging.reload();
			},
			addressConfirm(e) {
				console.log('当前选择的地址是', e.obj.area.value)
				console.log('当前选择的地址是', e.obj.area.label)
				this.addressisShow = false
				this.seachform.cityId = e.value[1]
				this.seachform.areaId = e.value[2]
				this.seachform.provinceId = e.value[0]
				this.address = e.obj.area.label
				this.$refs.paging.reload();
			},
			sendSearch() {
				this.$refs.paging.reload();
			},
			getList(pageNo, pageSize) {
				console.log('分页数据====', pageNo, pageSize)
				let send = {
					pageNum: pageNo,
					pageSize: pageSize,
					keyWords:this.seachform.keyWords,
					cityId:this.seachform.cityId,
					areaId:this.seachform.areaId,
					provinceId:this.seachform.provinceId
				}
				index.getPublicMember(send, 'client/recuitjob/listNoSe', 'get', res => {
					this.$refs.paging.complete(res.data.result.records);
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import url("index.css");
	@import url("@/static/css/publics.css");

	::v-deep {
		.u-navbar--fixed {
			background: #fff;

			// background-image: linear-gradient(to bottom, #42cdff, #0288ff);
			&>view {
				background: transparent !important;
			}

			.leftText {
				color: #000;
			}
		}
	}

	.content {
		background: #fff !important;
		height: 100vh;
	}

	.center {
		padding: 0rpx 20rpx 0rpx 20rpx;
		background: #fff;

		.searchTop {
			display: flex;
			padding: 20rpx;
			align-items: center;

			.addr {
				color: #424242;
				display: flex;
				margin-right: 16rpx;

				text {
					margin-right: 4rpx;
				}
			}

			.search {
				flex: 1;
				display: flex;
				background: rgba($color: #E4F0FF, $alpha: 0.3);
				height: 60rpx;
				padding: 0 10rpx;
				border-radius: 8rpx;
				margin-right: 20rpx;

				::v-deep {
					.u-input {
						margin: 0 10rpx;
					}
				}
			}

			.right {
				color: #0F0F0F;
			}
		}
	}
</style>